package com.stone.framework.user.entity;

import javax.persistence.Column;
import javax.persistence.Entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.stone.framework.core.entity.CommonEntity;
import com.stone.framework.core.util.Strings;

@TableName("ST_RESOURCE")
@Entity(name = "ST_RESOURCE")
public class Resource extends CommonEntity {

    private static final long serialVersionUID = -7408030048381667185L;

    @TableField("PARENT_ID")
    @Column(name = "PARENT_ID")
    private Long parentId;

    @TableField("CODE")
    @Column(name = "CODE")
    private String code;

    @TableField("NAME")
    @Column(name = "NAME")
    private String name;

    @TableField("DESC_")
    @Column(name = "DESC_")
    private String desc;

    @TableField("ICON")
    @Column(name = "ICON")
    private String icon;

    @TableField("LABEL_")
    @Column(name = "LABEL_")
    private String label;

    @TableField("ORDER_")
    @Column(name = "ORDER_")
    private Integer order;

    @TableField("TYPE")
    @Column(name = "TYPE")
    private Type type;

    @TableField("STATE")
    @Column(name = "STATE")
    private State state;

    public static enum Type {
        MENU, LIST, BUTTON;
    }

    public static enum State {
        ENABLED, DISABLED;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public String getIcon() {
        return icon;
    }

    public void setIcon(String icon) {
        this.icon = icon;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public Integer getOrder() {
        return order;
    }

    public void setOrder(Integer order) {
        this.order = order;
    }

    public String getType() {
        return type == null ? null : type.name();
    }

    public void setType(String type) {
        this.type = Strings.isEmpty(type) ? null : Type.valueOf(type);
    }

    public String getState() {
        return state == null ? null : state.name();
    }

    public void setState(String state) {
        this.state = Strings.isEmpty(state) ? null : State.valueOf(state);
    }

}
